﻿/*
**  CollisionFilter
*/
if (!$.Engine.Dynamic || typeof $.Engine.Dynamic === "undefined") $.Engine.Dynamic = {};
$.Engine.Dynamic.CollisionFilter = function () { }
Object.extend($.Engine.Dynamic.CollisionFilter.prototype, {
  ShouldCollide: function (shape1, shape2) {
    if (shape1.m_groupIndex == shape2.m_groupIndex && shape1.m_groupIndex != 0) {
      return shape1.m_groupIndex > 0;
    }

    var collide = (shape1.m_maskBits & shape2.m_categoryBits) != 0 && (shape1.m_categoryBits & shape2.m_maskBits) != 0;
    return collide;
  }
});
$.Engine.Dynamic.CollisionFilter.defaultFilter = new $.Engine.Dynamic.CollisionFilter();
